package com.open.capacity.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.open.capacity.mapper.StationMapper;
import com.open.capacity.model.PageModel;
import com.open.capacity.model.Station;
import com.open.capacity.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StationServiceImpl implements StationService {
    @Autowired
    private StationMapper mapper;
    @Override
    public void add(Station station) {
        mapper.add(station);
    }

    @Override
    public void delete(Long statid) {
mapper.delete(statid);
    }

    @Override
    public void update(Station station) {
mapper.update(station);
    }

    @Override
    public PageInfo findPage(PageModel page, Station station) {
        PageHelper.startPage(page.getPage(),page.getLimit());
        List<Station> all = mapper.findAll(station);
        return new PageInfo<>(all);
    }

    @Override
    public Station findById(Long statid) {
        return mapper.findById(statid);
    }
}

